﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Data;
using System.Globalization;

namespace CCF20Module
{
    [ValueConversion(typeof(DateTime), typeof(string))]
    public class DateToStringConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if ( value is DateTime)
            {
                DateTime dateTime = (DateTime)value;
                return dateTime.ToString("yyyy-MM-dd");
                
            }
            else
            {
                return string.Empty;
            }
            
        }
        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            //if (((string)value).Equals("是"))
            //    return true;
            //else
            //    return false;
            return null;
        }
    }

}
